
const nextSequenceValueHelper = {}

nextSequenceValueHelper.preSchemaName = function(schemaName, sequenceName) {
	console.log(sequenceName)
	schemaName.statics.getNextSequenceValue = async function (sequenceName) {
	  const sequenceDocument = await this.findOneAndUpdate(
	    { _id: sequenceName },
	    { $inc: { sequence_value: 1 } },
	    { new: true, upsert: true }
	  );
	  return sequenceDocument.sequence_value;
	};
}


module.exports = nextSequenceValueHelper;